<template>
  <div>
    <template v-for="item in this.menuList">
      <el-submenu :disabled="item.disabled" :index="item.id+''" v-if="item.children.length>0" :key="item.id+''">
        <template slot="title">
          <i :class="item.icon"></i>
          <span slot="title">{{ item.menuName}}</span>
        </template>
        <MenuTree :menuList="item.children"></MenuTree>
      </el-submenu>
      <el-menu-item v-else :disabled="item.disabled" :index="item.url+''" :route="item.url" @click="savePath(item.url)" :key="item.id+''" >
        <i :class="item.icon"></i>
        <span>{{item.menuName}}</span>
      </el-menu-item>
    </template>
  </div>
</template>

<script>
  export default {
    name: 'MenuTree',
    data() {
      return {

      };
    },
    beforeMount() {},
    props: ['menuList'],
    methods:{
      //保存激活路径
      savePath(path) {
        window.sessionStorage.setItem("activePath", path);
        this.activePath = path;
        },
    },
    created(){
    }
  };
</script>

<style scoped>

</style>
